#include <iostream>
using namespace std;

int func(int n, int k)
{
	if(k == 1)
		return n % 10;
	else
		return func(n / 10, k - 1);
}

int main()
{
	int n, k;
	cin >> n >> k;
	cout << func(n, k) << endl;
	return 0;
}
